import React from 'react';
import ProForm, {ProFormText,} from "@ant-design/pro-form";
import {AlterUser} from "@/services/ant-design-pro/management"
import {Form, message, Modal} from "antd";

const MyComponent = (props) => {
  const {isedit, issetEdit, showData,Formlist} = props
  const [form] = Form.useForm()
  return (
    <Modal
      visible={isedit}
      onCancel={() => {
        issetEdit(false)
      }}
      width={1200}
      title="管理类编辑"
      footer={false}
    >
     <ProForm
     form={form}
     onFinish={async (value) =>{
       message.success('提交成功');
       AlterUser(showData.id,{
         account: value.account,
         real_name:value.real_name,
         roles:value.roles,
         password:value.password,
         password_confirmation:value.password_confirmation
       })
       Formlist(value)
       return issetEdit(false);
     }}
     >
       <ProFormText
         label="姓名："
         name="real_name"
         initialValue={showData.real_name}
       />
       <ProFormText
         label="账号："
         name="account"
         initialValue={showData.account}
       />
       <ProFormText
         label="密码："
         name="password"
         initialValue={showData.password}
       />
       <ProFormText
         label="确认密码："
         name="password_confirmation"
         initialValue={showData.password_confirmation}
       />
       <ProFormText
         label="身份："
         name="roles"
         initialValue={showData.roles}
       />
     </ProForm>
    </Modal>
  );
};

export default MyComponent;
